package website.digitalocean.chapter6;

import cn.hutool.core.text.StrFormatter;

import java.util.ArrayList;
import java.util.List;

/**
 * @author: longhc@citycloud.com.cn
 * @since: 2023/2/10 9:44
 * @version: 1.0
 */
public class Employee {

    private String name;
    private String dept;
    private Integer salary;
    private List<Employee> list;

    public Employee(String name, String dept, Integer salary) {
        this.name = name;
        this.dept = dept;
        this.salary = salary;
        this.list = new ArrayList<>();
    }

    public void add(Employee employee) {
        list.add(employee);
    }

    public void remove(Employee employee) {
        list.remove(employee);
    }

    public List<Employee> list() {
        return list;
    }

    @Override
    public String toString() {
        return StrFormatter.format("name:{}; dept:{}; salary:{}", this.name, this.dept, this.salary);
    }
}
